Skip to content

enable child channel plugins#12578

Draft
AgraVator wants to merge 6 commits intogrpc:masterfrom
AgraVator:child-channel-plugin
Draft

enable child channel plugins#12578
AgraVator wants to merge 6 commits intogrpc:masterfrom
AgraVator:child-channel-plugin

Conversation

@AgraVator
Copy link
Contributor

No description provided.

Comment on lines +34 to +37
ObjectPool<XdsClient> getOrCreate(
String target, BootstrapInfo bootstrapInfo, MetricRecorder metricRecorder,
ManagedChannel parentChannel);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a generic object instead of ManagedChannel ?

Comment on lines 147 to +149
return new XdsServerWrapper("0.0.0.0:" + port, delegate, xdsServingStatusListener,
filterChainSelectorManager, xdsClientPoolFactory, bootstrapOverride, filterRegistry);
filterChainSelectorManager, xdsClientPoolFactory, bootstrapOverride, filterRegistry,
this.childChannelConfigurer);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this not pass the builder object ?

@@ -0,0 +1,70 @@
/*
* Copyright 2025 The gRPC Authors
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: 2026

Comment on lines +63 to +64
* universal configuration methods (like {@code intercept()}, {@code userAgent()}) rather
* than casting to specific implementation types.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* universal configuration methods (like {@code intercept()}, {@code userAgent()}) rather
* than casting to specific implementation types.
* universal configuration methods (like {@code intercept()}, {@code userAgent()}) on the builder rather
* than casting it to specific implementation types.

Copy link
Member

@ejona86 ejona86 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know there will be changes based on the gRFC discussion, but here are some things I noticed.

*
* @param delegate the configurer to wrap.
*/
public static ChildChannelConfigurer safe(ChildChannelConfigurer delegate) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is throwing, then something very wrong is happening. How does whoever is using this know it is safe to ignore? Note that the builder can be half-configured, so the built channel may be broken. This seems like a bad idea.

* @param condition true to apply the delegate, false to do nothing.
* @param delegate the configurer to apply if condition is true.
*/
public static ChildChannelConfigurer conditional(boolean condition,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an if. Given how simple this implementation is, is it really better than a user doing the ternary operator themselves? It seems like using this would reduce readability.

* @since 1.79.0
*/
@Internal
public ChildChannelConfigurer getChildChannelConfigurer() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we will want to pass the configurer explicitly down in our APIs. It is weird to add an internal API to access the Channel only so that some other internal getter API can be accessed. That is very indirect. We can just return the final object directly.

* @since 1.79.0
*/
@Internal
public ChildChannelConfigurer getChildChannelConfigurer() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be unused. Delete it. XdsServerBuilder needs it, but it has access to the value already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants